<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script src="md5.min.js"></script>
		<script>
			let xhr=new XMLHttpRequest;
			
			xhr.open("POST","http://127.0.0.1:9999/user/login");
			
			xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			
			xhr.timeout=60000;//请求超时时间 单位毫秒
			
			xhr.withCredentials=true;//是否允许携带跨域资源凭证(cookie) true 允许  false不允许
			
			xhr.onreadystatechange=function(){
				if(xhr.readyState===4){
					if(xhr.status>=200&&xhr.status<400){
						console.log(xhr.response);
					}
				}
			}
			xhr.ontimeout=function(){
				console.log("请求超时");
			}
			//urlencoded 格式
			xhr.send(`account=18310612838&password=${md5("1234567890")}`);
			
			console.log(xhr);
		</script>
	</body>
</html>
